#include <iostream>
#define ElemType int
using namespace std;
typedef struct {
    int *elem;
    int length;
} SqList;

void InitList_Sq(SqList &L) {
    int n;
    cin>>n;
    L.elem=new int [100];
    for(int i=0; i<n; i++)
        cin>>L.elem[i];
    L.length=n;
}
void ListDelete_Sq(SqList &L,int i) {
    int *p,*q;
    p=&(L.elem[i-1]);
    q=L.elem+L.length-1;
    for(++p; p<=q; ++p) {
        *(p-1)=*p;
    }
    L.length--;
}
void DeleteElem(SqList &L) {
    int delelem,i;
    cin>>delelem;
    for(i=1; i<=L.length; i++) {
        if(L.elem[i-1]<delelem) {
            ListDelete_Sq(L,i);
            i=0;
        }
    }
}
void Load_Sq(SqList &L) {
    for(int i=0; i<L.length; i++)
        cout<<L.elem[i]<<" ";
    cout<<endl;
}

int main() {
    SqList T;
    InitList_Sq(T);
    Load_Sq(T);
    DeleteElem(T);
    Load_Sq(T);
    return 0;
}
